# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'Forum'
        db.create_table('forum_forum', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=1024)),
        ))
        db.send_create_signal('forum', ['Forum'])

        # Adding model 'ForumThread'
        db.create_table('forum_forumthread', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('forum', self.gf('django.db.models.fields.related.ForeignKey')(related_name='threads', to=orm['forum.Forum'])),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=512)),
            ('latest_instructor_reply', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['forum.ForumEntry'])),
            ('latest_assistant_reply', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['forum.ForumEntry'])),
            ('is_sticky', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('is_locked', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('is_deleted', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('first_entry', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['forum.ForumEntry'])),
            ('last_entry', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['forum.ForumEntry'])),
        ))
        db.send_create_signal('forum', ['ForumThread'])

        # Adding model 'ForumEntry'
        db.create_table('forum_forumentry', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('thread', self.gf('django.db.models.fields.related.ForeignKey')(related_name='entries', to=orm['forum.ForumThread'])),
            ('quoted_entry', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
            ('entry_number', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
            ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['participants.CourseParticipant'])),
            ('entry', self.gf('django.db.models.fields.TextField')()),
            ('creation_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
            ('edited_date', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
            ('flagged_for_moderator', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('flagged_as_deleted', self.gf('django.db.models.fields.BooleanField')(default=False)),
        ))
        db.send_create_signal('forum', ['ForumEntry'])

        # Adding model 'ForumEntryLike'
        db.create_table('forum_forumentrylike', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('course_participant', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['participants.CourseParticipant'])),
            ('entry', self.gf('django.db.models.fields.related.ForeignKey')(related_name='likes', to=orm['forum.ForumEntry'])),
        ))
        db.send_create_signal('forum', ['ForumEntryLike'])

        # Adding model 'ForumBan'
        db.create_table('forum_forumban', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('course_participant', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['participants.CourseParticipant'])),
            ('forum', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['forum.Forum'])),
            ('forum_ban', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
            ('message_ban', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
        ))
        db.send_create_signal('forum', ['ForumBan'])

        # Adding model 'ForumPrivateMessage'
        db.create_table('forum_forumprivatemessage', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('forum', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['forum.Forum'])),
            ('recipient', self.gf('django.db.models.fields.related.ForeignKey')(related_name='received_messages', to=orm['auth.User'])),
            ('sender', self.gf('django.db.models.fields.related.ForeignKey')(related_name='sent_messages', to=orm['auth.User'])),
            ('message', self.gf('django.db.models.fields.TextField')()),
            ('subject', self.gf('django.db.models.fields.CharField')(max_length=512)),
            ('response_to', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='replies', null=True, to=orm['forum.ForumPrivateMessage'])),
            ('send_date', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
            ('flagged_date', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
            ('read_date', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
            ('deleted_date', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
        ))
        db.send_create_signal('forum', ['ForumPrivateMessage'])


    def backwards(self, orm):
        # Deleting model 'Forum'
        db.delete_table('forum_forum')

        # Deleting model 'ForumThread'
        db.delete_table('forum_forumthread')

        # Deleting model 'ForumEntry'
        db.delete_table('forum_forumentry')

        # Deleting model 'ForumEntryLike'
        db.delete_table('forum_forumentrylike')

        # Deleting model 'ForumBan'
        db.delete_table('forum_forumban')

        # Deleting model 'ForumPrivateMessage'
        db.delete_table('forum_forumprivatemessage')


    models = {
        'auth.group': {
            'Meta': {'object_name': 'Group'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
        },
        'auth.permission': {
            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        'auth.user': {
            'Meta': {'object_name': 'User'},
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
        },
        'contenttypes.contenttype': {
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        },
        'course.course': {
            'Meta': {'object_name': 'Course'},
            'accessible_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'activity_title': ('django.db.models.fields.CharField', [], {'default': "'Activity'", 'max_length': '50'}),
            'activity_title_plural': ('django.db.models.fields.CharField', [], {'default': "'Activities'", 'max_length': '50'}),
            'anonymous_grading_default': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'class_roster_title': ('django.db.models.fields.CharField', [], {'default': "'Class'", 'max_length': '50'}),
            'course_css': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'course_description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'course_favicon': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'course_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
            'course_js': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'course_subtitle': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'course_title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'default_submissions_allowed': ('django.db.models.fields.PositiveIntegerField', [], {'default': '10'}),
            'default_time_due': ('django.db.models.fields.TimeField', [], {'default': 'datetime.time(23, 59, 59)'}),
            'display_grade_metrics': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'event_calendar_percent': ('django.db.models.fields.FloatField', [], {'default': '66.66'}),
            'event_calendar_show_time_due': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'forum': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'courses'", 'null': 'True', 'to': "orm['forum.Forum']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'show_class_roster': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'show_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
        },
        'forum.forum': {
            'Meta': {'object_name': 'Forum'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'})
        },
        'forum.forumban': {
            'Meta': {'object_name': 'ForumBan'},
            'course_participant': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['participants.CourseParticipant']"}),
            'forum': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Forum']"}),
            'forum_ban': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'message_ban': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
        },
        'forum.forumentry': {
            'Meta': {'ordering': "['entry_number']", 'object_name': 'ForumEntry'},
            'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['participants.CourseParticipant']"}),
            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'edited_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'entry': ('django.db.models.fields.TextField', [], {}),
            'entry_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
            'flagged_as_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'flagged_for_moderator': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'quoted_entry': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'thread': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'entries'", 'to': "orm['forum.ForumThread']"})
        },
        'forum.forumentrylike': {
            'Meta': {'object_name': 'ForumEntryLike'},
            'course_participant': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['participants.CourseParticipant']"}),
            'entry': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'likes'", 'to': "orm['forum.ForumEntry']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
        },
        'forum.forumprivatemessage': {
            'Meta': {'object_name': 'ForumPrivateMessage'},
            'deleted_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'flagged_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'forum': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['forum.Forum']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'message': ('django.db.models.fields.TextField', [], {}),
            'read_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'recipient': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'received_messages'", 'to': "orm['auth.User']"}),
            'response_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'replies'", 'null': 'True', 'to': "orm['forum.ForumPrivateMessage']"}),
            'send_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'sender': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'sent_messages'", 'to': "orm['auth.User']"}),
            'subject': ('django.db.models.fields.CharField', [], {'max_length': '512'})
        },
        'forum.forumthread': {
            'Meta': {'ordering': "['-is_sticky', '-last_entry__creation_date', '-first_entry__creation_date']", 'object_name': 'ForumThread'},
            'first_entry': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['forum.ForumEntry']"}),
            'forum': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'threads'", 'to': "orm['forum.Forum']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_locked': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_sticky': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'last_entry': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['forum.ForumEntry']"}),
            'latest_assistant_reply': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['forum.ForumEntry']"}),
            'latest_instructor_reply': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['forum.ForumEntry']"}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '512'})
        },
        'participants.courseparticipant': {
            'Meta': {'unique_together': "(('user', 'course'),)", 'object_name': 'CourseParticipant'},
            'course': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['course.Course']"}),
            'email_new_messages': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'forum_entries_per_page': ('django.db.models.fields.PositiveIntegerField', [], {'default': '10'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'status': ('django.db.models.fields.CharField', [], {'default': "'STUDENT'", 'max_length': '15'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
        }
    }

    complete_apps = ['forum']